﻿#pragma once

#include "MirControl.h"
#include "../../Shared/Packet.h"

using namespace Client::MirGraphics;
using namespace Client::MirNetwork;
using namespace Client::MirScenes;
using namespace SlimDX::Direct3D9;
namespace S = ServerPackets;
namespace C = ClientPackets;

namespace Client::MirControls
{
    class MirScene : public MirControl
    {
    public:
        static MirScene *ActiveScene;

    private:
        static MouseButtons *_buttons;
        static long long _lastClickTime;
        static MirControl *_clickedControl;

    protected:
        MirScene();

    public:
        Size *getSize() const final override;
        void setSize(Size *value) final override;

        void Draw() override;

    protected:
        void CreateTexture() override;

    public:
        void OnMouseDown(MouseEventArgs *e) override;
        void OnMouseUp(MouseEventArgs *e) override;
        void OnMouseMove(MouseEventArgs *e) override;
        void OnMouseWheel(MouseEventArgs *e) override;

        void OnMouseClick(MouseEventArgs *e) override;

        void OnMouseDoubleClick(MouseEventArgs *e) override;

        void Redraw() override;

        virtual void ProcessPacket(Packet *p);

    private:
        void NewItemInfo(S::NewItemInfo *info);

        void NewChatItem(S::NewChatItem *p);

        void NewQuestInfo(S::NewQuestInfo *info);

        void NewRecipeInfo(S::NewRecipeInfo *info);

        static void Disconnect(S::Disconnect *p);

    public:
        virtual void Process() = 0;

        #pragma region Disposable

    protected:
        void Dispose(bool disposing) override;

        #pragma endregion
    };
}
